
var initScreen=function(callback){//初始化html  font-size
    //$("html").css("font-size",document.documentElement.clientHeight/document.documentElement.clientWidth<1.5 ? (document.documentElement.clientHeight/603*312.5+"%") : (document.documentElement.clientWidth/375*312.5+"%")); //单屏全屏布局时使用,短屏下自动缩放
    $("html").css("font-size",document.documentElement.clientWidth/375*312.5+"%");//长页面时使用,不缩放
    if(callback)callback();
},
navTab = function(){
    //轮播图
    var mySwiperH = new Swiper ('.swiper-container-h', {
        direction: 'horizontal',
        loop: true,
        pagination: '.swiper-pagination-h',
        autoplay : 5000,
        autoplayDisableOnInteraction: false
    });
    var mySwiperV = new Swiper ('.swiper-container-v', {
        direction: 'vertical',
        onlyExternal : true,
        loop: true,
        autoplay : 5000,
        autoplayDisableOnInteraction: false
    });

    //导航
    var nav_items_li = $(".nav-items li");
    var _this;
    /*var nav_items_li_length = nav_items_li.length;
    var nav_items_width = 0;
    for(var i = 0; i < nav_items_li_length; i++){
        nav_items_width += nav_items_li.eq(i).width();
        console.log(nav_items_li.eq(i).width());
    }
    $(".nav-items").css("width",nav_items_width);*/
    nav_items_li.on('mousedown',function(e){
        _this = $(this).index();
        nav_items_li.removeClass('cur').eq(_this).addClass('cur');
    });
    //tab
    var tab_hd_ul_li = $(".tab-hd ul li");
    var tab_bd = $(".tab-bd");
    var _this;
    tab_hd_ul_li.on('touchstart mousedown',function(e){
        _this = $(this).index();
        tab_hd_ul_li.removeClass('cur').eq(_this).addClass('cur');
        tab_bd.hide().eq(_this).show();
    });

},
_addEvent = function(){
    window.addEventListener("orientationchange" in window ? "orientationchange" : "resize",function(e){
        var st=setTimeout(initScreen,300);
    }, false);
}

$(function(){
    initScreen(function(){
        navTab();
        _addEvent();
        }
    );
})